Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-modules-local-by-default

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-modules-local-by-default

A CSS Modules transform to make local scope the default

  • 2.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13M
decreased by-27.9%
Maintainers
3
Weekly downloads
 
Created

What is postcss-modules-local-by-default?

The postcss-modules-local-by-default npm package is a PostCSS plugin that modifies CSS class names to be locally scoped by default. This is part of CSS Modules, which helps avoid class name collisions and ensures styles are encapsulated to specific components only. It rewrites all class names in CSS files to be scoped locally unless explicitly specified otherwise.

What are postcss-modules-local-by-default's main functionalities?

Local Scoping of Class Names

Automatically transforms global CSS class names into locally scoped names. This prevents class name collisions across different components or sections of a web application.

/* Input CSS */
.className {
  color: red;
}

/* Output CSS after processing with postcss-modules-local-by-default */
._className_xkpkl_1 {
  color: red;
}

Selective Global Scoping

Allows developers to selectively keep some class names global. This is useful for overriding styles or for styles that are meant to be consistent across various components.

/* Input CSS */
:global(.globalClassName) {
  color: blue;
}

/* Output CSS remains unchanged */
.globalClassName {
  color: blue;
}

Other packages similar to postcss-modules-local-by-default

Keywords

FAQs

Package last updated on 05 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc